home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / FNTPAK32.ZIP / PASCAL.EXE / DEMOBRIT.PAS < prev    next >
Pascal/Delphi Source File  |  1995-08-16  |  6KB  |  201 lines

  1. {*************************************************************************
  2.  
  3.   DemoBrit.PAS                          Copyright 1994 Rob W. Smetana
  4.  
  5.   Demonstrate using all procedures in Video.Obj:
  6.  
  7.      1.  GetMonitor      Determine monitor types, especially if EGA/VGA.
  8.  
  9.      2.  BrightBG        Switch between blinking foreground colors and
  10.                          bright background colors.
  11.  
  12.      3.  DefaultPalette  Another way to achieve bright background colors,
  13.                          but without giving up blinking colors.
  14.  
  15.      4.  DarkBlue        A subset of DefaultPalette, lets you select
  16.                          dark blue backgrounds -- and leave all other
  17.                          colors and blinking intact.
  18.  
  19.   Also demonstrate using Font_Dec.Pas to declare all Font Pak routines --
  20.   except callable OBJ fonts.
  21.  
  22.   IMPORTANT:  Assembler routines in Video.Obj REQUIRE that parameters
  23.               be passed by value -- not by reference.
  24.  
  25.               Also, all parameters MUST be integers.
  26.  
  27. *************************************************************************}
  28.  
  29. uses CRT, Font_Pak;             {Font_Pak.Pas declares/links everything}
  30.  
  31. Var
  32.  
  33.     Ch : Char;
  34.     On_or_Off, WhichPalette, Char: Integer;
  35.     FG, BG, BaseValue, Row, WhichMonitor: Integer;
  36.  
  37.  
  38. Procedure Is_it_EGA_or_VGA;
  39.  
  40. {************************************ Demonstrate GetMonitor          }
  41. {                                     Bail out if EGA or VGA not found}
  42.  
  43. Begin
  44.  
  45.      TextAttr := 23; ClrScr;
  46.  
  47.      fpInitialize; ClrScr;      { useful for shareware versions only }
  48.  
  49.      Write (' GetMonitor reports you have ');
  50.  
  51.      WhichMonitor := GetMonitor;
  52.  
  53.      { bail out if there's no EGA or VGA }
  54.      case WhichMonitor of
  55.           0, 4, 5:              { 0=No monitor, 4 = CGA, 5 = Monochrome }
  56.              Begin
  57.                  ClrScr;
  58.                  WriteLn('     This demo requires an EGA or VGA monitor.  Sorry, I have to end.');
  59.                  halt;
  60.              end;
  61.           3: Write ('an EGA');
  62.         7,8: Write ('a VGA');
  63.      end; {case}
  64.  
  65.      Write (' monitor.   OK to proceed.  Press <SPACE>.');
  66.      Ch := ReadKey;
  67. End;
  68.  
  69. Procedure DisplayChars;
  70.  
  71.      Begin
  72.          FG := 0;                       {start with black foreground color}
  73.          Char := 65;
  74.          For BG := 0 to 7 do
  75.          Begin
  76.          gotoxy(15,Row);
  77.          TextBackground (BG);
  78.          For FG := 0 to 15 do
  79.              begin
  80.                 TextColor (BaseValue + FG);
  81.                 Write (' ',Chr(Char),' ');
  82.                 Inc (Char);
  83.              end;
  84.           Inc (Row);
  85.          End;
  86.      TextAttr := 23;
  87.      End;
  88.  
  89. Begin
  90.  
  91. {************************************ Demonstrate bright backgrounds  }
  92.  
  93.      Is_it_EGA_or_VGA;                  {should we be here at all?   }
  94.  
  95.      ClrScr; TextColor (14);
  96.      Write ('          Demonstrate BrightBG (bright backgrounds).  Press <SPACE>.');
  97.      Ch := ReadKey;
  98.  
  99.      BaseValue := 0;                    {start with NON-blinking colors}
  100.      Row := 4; DisplayChars;
  101.  
  102.      BaseValue := 16;                   {now use BLINKING colors     }
  103.      Row := 15; DisplayChars;
  104.  
  105.  
  106.      TextAttr := 112;
  107.      gotoxy(1,25); ClrEOL;
  108.      Write ('      Press <SPACE> to turn blinking colors into BRIGHT BACKGROUND colors.');
  109.      Ch := ReadKey;
  110.  
  111.      { call BrightBG, switching from blinking to bright backgrounds }
  112.  
  113.      On_or_Off := 1;                    {use any non-zero integer value}
  114.      BrightBG (On_or_Off);
  115.  
  116.      gotoxy(1,25); ClrEOL;
  117.      Write ('                   Press <SPACE> to restore BLINKING COLORS.');
  118.      Ch := ReadKey;
  119.  
  120.      On_or_Off := 0;                    {0 restores blinking           }
  121.      BrightBG (On_or_Off);
  122.  
  123.      gotoxy(1,25); ClrEOL;
  124.      Write ('                             And back to normal.');
  125.      Ch := ReadKey;
  126.  
  127. {************************************ Demonstrate changing the PALETTE }
  128.  
  129.      TextAttr := 23; ClrScr;  TextColor(14);
  130.      Write ('         Demonstrate DefaultPalette (Palette Changing).    Press <SPACE>.');
  131.      Ch := ReadKey;
  132.  
  133.      BaseValue := 0;                    {start with NON-blinking colors}
  134.      Row := 4; DisplayChars;
  135.  
  136.      BaseValue := 16;                   {now use BLINKING colors       }
  137.      Row := 15; DisplayChars;
  138.  
  139.      TextAttr := 112;
  140.      gotoxy(1,25); ClrEOL;
  141.      Write ('      Press <SPACE> to turn blinking colors into BRIGHT BACKGROUND colors.');
  142.      Ch := ReadKey;
  143.  
  144.      { call DefaultPalette, switching from blinking to bright backgrounds }
  145.  
  146.      On_or_Off := 2;                    {2 = use high intensity palette}
  147.      DefaultPalette (On_or_Off);
  148.  
  149.      gotoxy(1,25); ClrEOL;
  150.      Write ('      Notice BOTH blinking AND bright backgrounds.     Press <SPACE>.');
  151.      Ch := ReadKey;
  152.  
  153.      On_or_Off := 1;                    {1 = use low intensity palette}
  154.      DefaultPalette (On_or_Off);
  155.  
  156.      gotoxy(1,25); ClrEOL;
  157.      Write ('      Here''s LOW intensity with blinking backgrounds.   Press <SPACE>.');
  158.      Ch := ReadKey;
  159.      On_or_Off := 0;                    {0 = restore the default palette}
  160.      DefaultPalette (On_or_Off);
  161.  
  162.      gotoxy(1,25); ClrEOL;
  163.      Write ('                             And back to normal.');
  164.  
  165.      Ch := ReadKey;
  166.  
  167. {************************************ Demonstrate Dark Blue backgrounds}
  168.  
  169.      TextAttr := 23; ClrScr;  TextColor (14);
  170.      Write ('         Demonstrate DarkBlue (Change 1 palette only).     Press <SPACE>.');
  171.      Ch := ReadKey;
  172.  
  173.      BaseValue := 0;                    {start with NON-blinking colors}
  174.      Row := 4; DisplayChars;
  175.  
  176.      BaseValue := 16;                   {now use BLINKING colors       }
  177.      Row := 15; DisplayChars;
  178.  
  179.      TextAttr := 112;
  180.      gotoxy(1,25); ClrEOL;gotoxy(15,25);
  181.      Write ('Press <SPACE> to turn the background into DARK BLUE.');
  182.      Ch := ReadKey;
  183.  
  184.      { call DarkBlue }
  185.  
  186.      DarkBlue;
  187.  
  188.  
  189.      gotoxy(1,25); ClrEOL;gotoxy(33,25);
  190.      Write ('Press <SPACE>.');
  191.      Ch := ReadKey;
  192.  
  193.      On_or_Off := 0;                    {0 = restore the default palette}
  194.      DefaultPalette (On_or_Off);
  195.  
  196.      gotoxy(1,25); ClrEOL;gotoxy(30,25);
  197.      Write ('And back to normal.');
  198.  
  199.      Ch := ReadKey;
  200. End.
  201.